![]() |
PATH![]() |
![]() ![]() |
The Run command can function as an AppleScript command or an application command.
The application Run command launches an application if it is not already running. The application must be on a local or mounted volume. If the application is already running, then the effect of the Run command depends on the application. Some applications are not affected; others, such as SimpleText, repeat their startup procedures each time they receive a Run command.
The AppleScript Run command acts on script objects. It causes statements in a script object definition, other than handler and property definitions, to be executed. You do not use the Run command to directly execute individual script statements or to execute AppleScript or scripting addition commands.
The AppleScript Run command returns the result, if any, returned by the specified script object's Run handler.
run application "SimpleText"
tell application "SimpleText"
run
end tell
You do not use the Run command to directly execute individual script statements or to execute AppleScript or scripting addition commands:
run (save) --WRONG!
run (beep) --WRONG! (Don't try this!)
For more information, including additional examples, see the sections listed under Notes for this command.
To specify the name ( nameString ) of an application to run, use a string of the form " Disk : Folder1 : Folder2 :...: ApplicationName " ; for details, see References to Applications. You can also specify a string with only an application name (" ApplicationName "). In this case, if the application is not already running, AppleScript attempts to find the application using the Desktop Database maintained by the Finder.
AppleScript sends an implicit Run command whenever it begins to execute a Tell statement whose target is an application that is not already open. This can cause problems with applications such as SimpleText that normally perform specific tasks on startup, such as opening a new window. To launch an application without invoking its usual startup behavior, use the Launch command, as described in Launch. For information about using the Run and Launch commands with script applications, see Calling a Script Application From a Script.
For information about Run handlers, see Run Handlers. For information about using the Run command with script objects, see Script Objects.